<!DOCTYPE html>
<html xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include/src :: form_base_js_and_css"/>
</head>
<body style="background-color: #f2f2f2; height: 100%;">

<div id="id_panel">
</div>
<script th:inline="javascript">
	// 表单初始化
	var formObj = null;
	//使用layui的sku模块
	layui.config({
		//自定义layui组件的目录,设定扩展的layui模块的所在目录，一般用于外部模块扩展
		base: '/static/js/layui_extends/',
		version: true
	}).use(['form', 'jquery', 'laydate', 'YsForm', 'YsModal'], function(){
		var $ = layui.jquery,
				form = layui.form,
				laydate = layui.laydate,
				YsForm = layui.YsForm,
				YsModal = layui.YsModal;
		/*
		* 表单初始化
		* 参数1：表单配置参数
		* 参数2：子表配置参数
		*/
		formObj = YsForm.init(
				{
					id:'id_panel', // 页面容器ID
					dto: $.parseJSON(JSON.stringify([[${dto}]]))
				}
		);
		$('#' + formObj.c.id_header).find('.bg_color_white').find('.layui-inline').html('');

		$('#' + formObj.c.id_header).find('.bg_color_white').find('.layui-inline')
				.append(`<button type="button" class="layui-btn layui-btn-normal" lay-submit lay-filter="formSubmit" data-action="/api/inter/tcgPurchaseOrderPay/toEdit" data-id="id_btn_save"><i class="iconfont icon-save"></i>保存并跳转</button>`);


		/**
		 * 监听
		 */
		var domForm1 = $('#' + formObj.c.id_form);
		//监听付款方式
		form.on('select(_input_filter_selector_on_form)', function(data) {
			var name = $(data.elem).attr('name');
			if (name == 'payType'){
				var payType = formObj.getValueByName("payType");
				console.log('payType111',payType);
				if(payType=='1'){//方式为跨境宝
					domForm1.find('input[name="vid"]').val("ZHBM00001");
					domForm1.find('input[name="vyhzhmc"]').val("问前集团控股有限公司/CNH");
					domForm1.find('input[name="vyhzh"]').val("2120120239008552");
					domForm1.find('input[name="vkhh"]').val("WorldFirst");
				}else {
					domForm1.find('input[name="vid"]').val("");
					domForm1.find('input[name="vyhzhmc"]').val("");
					domForm1.find('input[name="vyhzh"]').val("");
					domForm1.find('input[name="vkhh"]').val("");
				}
			}
		});


		//重写弹出框
		formObj.showModal=function(modalKey, colCode) {
			var t = formObj;
			//console.log("modalKey",modalKey);
			//console.log("colCode",colCode);
			if(colCode == 'vid'){//付款账户编码弹框
				var payType = formObj.getValueByName("payType");//付款方式
				if(payType == '0'){
					layui.YsModal.init({modalKey: modalKey, colCode: colCode, parentObj: t, extraData:{}, conditionsDefault: [], sameCode: 'xx'});
				}else {
					return layer.msg("付款方式为跨境宝时，付款账户编码默认为ZHBM00001，不可更改！");
				}

			}
			/*
			else{
				// 打开单选框,
				layui.YsModal.init({modalKey: modalKey, colCode: colCode, parentObj: t, extraData:{}, conditionsDefault: [{code: 'aaa', value:'123'},{code: 'bbb', value:'456'}], sameCode: 'xx'});
			}
			 */

		}




	});


</script>

</body>
</html>